/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-03-17
 * Time: 23:33
 */
public class Student{
    public String name;
    public static String classRoom = "one";

    public Student(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        // 将教室作为一个静态成员,静态成员变量可以直接通过类名访问
        System.out.println(Student.classRoom);//推荐，输出：one

        Student s1 = new Student("Li");
        Student s2 = new Student("zhang");
        Student s3 = new Student("wu");

        // 也可以通过对象访问：但是classRoom是三个对象共享的
        System.out.println(s1.classRoom);//输出：one
        System.out.println(s2.classRoom);//输出：one
        System.out.println(s3.classRoom);//输出：one
    }
}